<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>管理台登录页面</title>
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<script src="js/angular.min.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<script src="js/jquery.min.js"></script>

		

		<style>
			.form-login {
				max-width: 330px;
				margin: 0 auto;
				padding: 10px 20px;
				background-color: #FFFFFF;
				border-radius: 5px;
				box-shadow: 5px 5px 5px #BBB;
			}
			
			body {
				padding-top: 80px;
				background-color: #EEEEEE;
			}
			
			.form-login .form-group {
				margin: 0;
			}
			
			.form-login hr {
				margin: 0px;
			}
		</style>
	</head>

	<body>

		<div class="container" ng-app="app-login">
			<div ng-controller="ctrl-login">
				<form role="form" class="form-horizontal form-login">
					<div class="form-group">
						<label class="control-label">管理控制台</label>
						<hr />
					</div>
					<div class="form-group">
						<label for="username" class="control-label">用户名</label>
						<input type="text" class="form-control" id="username" placeholder="请输入用户名" ng-model="j_username" />
					</div>

					<div class="form-group">
						<label for="password" class="control-label">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>
						<input type="password" class="form-control" id="password" placeholder="请输入密码" ng-model="j_password" />
					</div>

					<div class="form-group">
						<label style="font-weight: normal;">
							<input type="checkbox" /> &nbsp; &nbsp;请记住我
						</label>
						<label ng-hide="warnhide" style="padding-left: 30px; font-weight: normal; color: red;" class="small"> 登录失败,{{message}}</label>
						<button class="btn btn-sm btn-primary btn-block" type="submit" ng-click="login()">登&nbsp;&nbsp;录</button>
					</div>
				</form>

			</div>
		</div>
		<script src="js/bootstrap.min.js"></script>
		<script src="https://code.jquery.com/jquery.js"></script>
		
		<script>
			var app = angular.module('app-login', []);
			app.controller("ctrl-login", function($scope, $http) {
				$scope.j_username = "zhoushuang";
				$scope.j_password = "password";
				$scope.warnhide = true;
				$scope.login = function() {
					$http({
						method: "get",
						data: {
							j_username: $scope.j_username,
							j_password: $scope.j_password
						},
						url: 'http://127.0.0.1:8020/consoleOne/json/login.json'
					}).success(function(response) {
						if (response.code == 0) {
							window.location = "index.html"
						} else {
							$scope.warnhide = false;
							$scope.message = response.message;
						}
					}).error(function(response, status) {});
				};
			});
		</script>
		
		
	</body>

</html>